//
//  LoginView.m
//  TFView
//
//  Created by lanou3g on 15/6/13.
//  Copyright (c) 2015年 多飞科技. All rights reserved.
//

#import "LoginView.h"
#import "TFView.h"
@implementation LoginView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/


-(void)dealloc{
    [_userNameLTView release];
    [_passWordLTView release];
    [_loginButton release];
    [_regniserButton release];
    [_findButton release];
    
    [super dealloc];
}



//重写初始化方法，把登陆页面完善
-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        NSArray*array = @[@"用户名：",@"密码："];
        for (int i = 0; i<2; i++) {
            TFView*ltView = [[TFView alloc]initWithFrame:CGRectMake(20, 100+80*i, 300, 50)];
            ltView.ltLabel.text = array[i];
            ltView.ltTextField.tag = 10+i;
            ltView.ltLabel.textAlignment = NSTextAlignmentRight;
//            ltView.ltTextField.delegate = self;
            [self addSubview:ltView];
            [ltView release];
            
            switch (i) {
                case 0:
                    _userNameLTView = [ltView retain];
                    
                    break;
                    case 1:
                    _passWordLTView = [ltView retain];
                    break;
                default:
                    break;
            }
            
        }
        
        NSArray*buttonArray = @[@"登录",@"注册",@"找回密码"];
        for (int i = 0; i<3; i++) {
            UIButton*button = [UIButton buttonWithType:UIButtonTypeSystem];
            button.frame = CGRectMake(30+100*i,260, 80, 30);
            button.backgroundColor = [UIColor whiteColor];
            [button setTitle:buttonArray[i] forState:UIControlStateNormal];
            [self addSubview:button];
            
            switch (i) {
                case 0:
                    _loginButton = [button retain];
                    break;
                    case 1:
                    _regniserButton = [button retain];
                    break;
                    case 2:
                    _findButton = [button retain];
                    break;
                default:
                    break;
            }
            
            
        }
       
        
        
        
    }
    
    return self;
}




//-(BOOL)textFieldShouldReturn:(UITextField *)textField{
//    UITextView*userTextView = (UITextView*)[self viewWithTag:10];
//    UITextView*passTextView = (UITextView*)[self viewWithTag:11];
//    if (10==textField.tag) {
//        [passTextView becomeFirstResponder];
//        [userTextView resignFirstResponder];
//        
//    }else if (11 == textField.tag){
//        
//          [passTextView resignFirstResponder];
//    }
//      
//    
//    
//    
//    return YES;
//}













@end
